/*
 * 创建日期 2009-12-14
 *
 * 成都天和软件公司
 * 电话：028-85425861
 * 传真：028-85425861-8008
 * 邮编：610041 
 * 版权所有
 */
package  org.fantasy.common.grid.head;

import javax.servlet.http.HttpServletRequest;

import org.dom4j.Element;

/**
 *  自定义配置表头
 * @author: 王文成
 * @version: 1.0
 * @since 2009-12-14
 */
public class TableHeadClass extends BaseTableHead {

    public TableHeadClass(HttpServletRequest request, String tableConfig) throws Exception {
        super(request,tableConfig);
    }

    /**
     * 取得Table节点
     * 
     * @return
     */
    @Override
    protected Element getTableElement() throws Exception {
        Class cls = Class.forName(tableConfig);
        if (TableConfigSupport.class.isAssignableFrom(cls)) {
            TableConfigSupport config = (TableConfigSupport) cls.newInstance();
            config.setHttpServletRequest(request);
            return config.getTableConfig();
        } else {
            throw new Exception("类型错误![" + tableConfig + "] 未继承 [ org.fantasy.common.grid.head.TableConfigSupport]");
        }
    }
}
